package tools 
{
	import flash.display.Graphics;
	import flash.events.MouseEvent;
	import flash.geom.Point;
	import screens.NoteCanvas;
	/**
	 * ...
	 * @author Andy Wolff
	 */
	public class PanScreenTool implements INoteTool
	{
		private var view:NoteCanvas;
		public function PanScreenTool(view:NoteCanvas) 
		{
			this.view = view;
		}
		
		private var mouseClicked:Boolean = false;
		private var previousPoint:Point;
		public function mouseDown(e:MouseEvent):void
		{
			mouseClicked = true;
			previousPoint = new Point(e.localX, e.localY);
		}
		
		public function mouseMove(e:MouseEvent):void
		{
			var p:Point = new Point(e.localX, e.localY);
			if (mouseClicked) view.panView(previousPoint.x-p.x);
			previousPoint = p;
		}
		
		public function mouseUp(e:MouseEvent):void
		{
			end();
		}
		
		public function end():void
		{
			mouseClicked = false;
			previousPoint = null;
		}
		
		public function draw(g:Graphics):void
		{
			//nothing
		}
		
	}

}